<template>
    <Header></Header>
    <Sort :sortList="sortList"></Sort>
    <Goods :goodsList="goodsList"></Goods>
    <Tabbar></Tabbar>
</template>

<script setup>
import Tabbar from '@/components/common/Tabbar.vue'
import Header from '@/components/Home/Header.vue'
import Sort from '@/components/Home/sort.vue'
import Goods from '@/components/Home/Goods.vue'
// 实现首页数据的获取
// import axios from 'axios';
import api from '@/common/api/request.js'
import { ref,onMounted } from 'vue';
// 商品列表数据
let goodsList = ref([])
// 商品分类数据
let sortList = ref([])
// 生命周期
onMounted(() => {
    getGoodsList()
})
// 获取商品列表数据
const getGoodsList = async () => {
    // const res = await axios.get('/api/index')
    let res = await api.$axios({
        url: '/api/index',
    })
    console.log(res);
    goodsList.value = res.goodsList
    sortList.value = res.sortList
}
</script>

<style scoped>
</style>